package jdbcTest;

import com.mysql.jdbc.jdbc2.optional.MysqlDataSource;

import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: tao
 * Date: 2023-11-13
 * Time: 19:47
 */
public class Test2 {
    public static void main(String[] args) throws SQLException {
        Scanner sc = new Scanner(System.in);
        int id = sc.nextInt();
        String name = sc.nextLine();

        //1、创建数据源
        DataSource dataSource = new MysqlDataSource();
        ((MysqlDataSource)dataSource).setUrl("jdbc:mysql://127.0.0.1:3306/java110/characterEncoding=utf8&&userSSL=false");
        ((MysqlDataSource)dataSource).setUser("root");
        ((MysqlDataSource)dataSource).setPassword("123456");

        //2、建立连接
        Connection connection = dataSource.getConnection();

        //创建语句（查下语句）


    }
}
